package com.example.stock.util;

import com.example.stock.excel.*;
import lombok.extern.log4j.Log4j2;

import java.util.*;

@Log4j2
public class StatisticDataUtil {

    static List<MonthLpDown> monthLpDownList;

    public static List<MonthLpDown> getMonthLpDown() {
        if (Objects.isNull(monthLpDownList)) {
            monthLpDownList = DataUtil.getListData(MonthLpDown.class, ExcelReaderUtil.FILE_STOCK_SAT, "跌破10分位点");
        }
        return monthLpDownList;
    }

    static List<MonthLpUp> monthLpUpList;

    /**
     * 获取月份突破10分位点列表
     * 如果列表为空，通过EasyExcel读取Excel文件并将其存储在列表中
     * @return 月份突破10分位列表
     */
    public static List<MonthLpUp> getMonthLpUp() {
        if (Objects.isNull(monthLpUpList)) {
            monthLpUpList = DataUtil.getListData(MonthLpUp.class, ExcelReaderUtil.FILE_STOCK_SAT, "突破10分位点");
        }
        return monthLpUpList;
    }

    static List<LevelPointDecrease> levelPointDecrease;

    public static List<LevelPointDecrease> getLevelPointDecrease() {
        if (Objects.isNull(levelPointDecrease)) {
            levelPointDecrease = DataUtil.getListData(LevelPointDecrease.class,ExcelReaderUtil.FILE_STOCK_SAT, "低分位点跌幅");
        }
        return levelPointDecrease;
    }

    static List<WeekLpUp> weekLpUpData;

    public static List<WeekLpUp> getWeekLpUpData() {
        if (Objects.isNull(weekLpUpData)) {
            weekLpUpData = DataUtil.getListData(WeekLpUp.class, ExcelReaderUtil.FILE_STOCK_SAT, "周线突破10分位点");
        }
        return weekLpUpData;
    }

    static List<WeekLpNewHigh> weekLpNewHighData;

    public static List<WeekLpNewHigh> getWeekLpNewHighs() {
        if (Objects.isNull(weekLpNewHighData)) {
            weekLpNewHighData = DataUtil.getListData(WeekLpNewHigh.class, ExcelReaderUtil.FILE_STOCK_SAT, "周线突破100分位点");
        }
        return weekLpNewHighData;
    }

    static List<MonthLpNewHigh> monthLpNewHighList;

    public static List<MonthLpNewHigh> getMonthLpNewHigh() {
        if (Objects.isNull(monthLpNewHighList)) {
            monthLpNewHighList = DataUtil.getListData(MonthLpNewHigh.class, ExcelReaderUtil.FILE_STOCK_SAT, "月突破100分位点");
        }
        return monthLpNewHighList;
    }
}